package controllers

import (
	beego "github.com/beego/beego/v2/server/web"
)

type MainController struct {
	beego.Controller
}

func (c *MainController) Get() {
	c.Data["Website"] = "beego.vip"
	c.Data["Email"] = "astaxie@gmail.com"
	c.TplName = "index.html"
}

// IfHasSession 验证session
func (c *MainController) IfHasSession() {
	if c.GetSession("UserName") == nil {
		c.Data["json"] = Status{ErrCode: NO_SESSION, Msg: "No Session!!!"}
		c.Redirect("/page/err400", 302)
	}
}
